﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SharedGenomics.Core;

namespace SharedGenomics.Domain
{
    [AttributeUsage(AttributeTargets.Property)]
    public class AnalysisResultColumnAttribute : Attribute
    {
        private object _defaultOnParseFailed;

        public AnalysisResultColumnAttribute()
        {
        }

        public AnalysisResultColumnAttribute(string columnName)
        {
            this.ColumnName = columnName;
        }

        public string ColumnName { get; private set; }

        public object DefaultOnParseFailed
        {
            get
            {
                ExceptionHelper.ThrowIf<InvalidOperationException>(!this.HasDefault);
                return this._defaultOnParseFailed;
            }
            set
            {
                this._defaultOnParseFailed = value;
                this.HasDefault = true;
            }
        }

        public bool HasDefault { get; private set; }
    }
}
